package com.chengzhi.netty.handler;

import com.chengzhi.nettycommoms.disruptor.MessageConsumer;
import com.chengzhi.nettycommoms.dto.NettyMessage;
import com.chengzhi.nettycommoms.dto.NettyMessageWapper;
import io.netty.util.ReferenceCountUtil;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ClientMessageConsumer extends MessageConsumer {
    public ClientMessageConsumer(String consumerId) {
        super(consumerId);
    }

    @Override
    public void onEvent(NettyMessageWapper nettyMessageWapper) throws Exception {
            try {
            NettyMessage response = nettyMessageWapper.getNettyMessage();
            log.info(consumerId + " paramter ----------" + response.toString());
        } finally {
            ReferenceCountUtil.release(nettyMessageWapper.getNettyMessage());
        }
    }
}
